#include "../tools.h"

class Solution {
public:

    string helper(int num){
        
        vector<char> d = {'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

        char res[100] = {0};
        int n = 0;
        while(num != 0){
            int id = num % 26;
            res[n++] = d[id];
            
            num /= 26;
            if(id % 26 == 0) num -= 1;
        }

        int bound = n / 2;
        for(int i = 0; i < bound; ++i){
            swap(res[i], res[n - 1 - i]);
        }

        return res;
    }

    string convertToTitle(int columnNumber) {
        return helper(columnNumber);
    }
};


int main(int argc, char const *argv[])
{
    
    int columnNumber = 2147483647;
    Solution s;

    string res = s.convertToTitle(columnNumber);
    cout << res << endl;


    return 0;
}
